package com.top.jwtdemo.config;

import com.top.jwtdemo.interceptor.CrossInterceptorHandler;
import com.top.jwtdemo.interceptor.LoginInterceptor;
import org.springframework.beans.factory.annotation.Configurable;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author  Cjj
 * @data   2024/6/17 12:13
 * @blog   配置类
 */
@Configurable
public class WebConfig implements WebMvcConfigurer {
    //excludePathPatterns 去开启某些路径
    @Override
    public  void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new CrossInterceptorHandler()).addPathPatterns("/**");
        registry.addInterceptor(new LoginInterceptor()).addPathPatterns("/**").excludePathPatterns("/usr/login","/error/**");
    }

}
